//
//  LZFLoginAndRegisterVC.m
//  LZFBuDieJie
//
//  Created by 梁梓烽 on 16/6/21.
//  Copyright © 2016年 liangzifeng. All rights reserved.
//

#import "LZFLoginAndRegisterVC.h"
#import "LZFLoginAndRegisterView.h"
#import "LZFFastLoginView.h"


@interface LZFLoginAndRegisterVC ()
@property (weak, nonatomic) IBOutlet UIView *middleView;
@property (weak, nonatomic) IBOutlet UIView *bottomView;

@property(nonatomic,strong)UIView *loginView;
@property(nonatomic,strong)UIView *registerView;
@property(nonatomic,strong)UIView *fastLoginView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leadingContrasit;

@end

@implementation LZFLoginAndRegisterVC

- (IBAction)click:(UIButton *)sender {
    sender.selected=!sender.selected;

    self.leadingContrasit.constant=sender.selected?-screenW:0;
    
    [UIView animateWithDuration:0.5 animations:^{
        
        [self.view layoutIfNeeded];
        
    }];
    
}

- (IBAction)clickCancle:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];

   UIView *loginView = [LZFLoginAndRegisterView loginView];
    self.loginView=loginView;
    [self.middleView addSubview:loginView];
    
    UIView *registerView = [LZFLoginAndRegisterView registerView];
    self.registerView=registerView;
    [self.middleView addSubview:registerView];
    
    
    UIView *fastLoginView=[LZFFastLoginView fastLoginView];
    self.fastLoginView=fastLoginView;
    [self.bottomView addSubview:fastLoginView];
}

-(void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
    
   
    
    //loginView
    self.loginView.frame=CGRectMake(0, 0, screenW, self.middleView.xmg_height);
    
    
    //registerView
    self.registerView.frame=CGRectMake(screenW, 0, screenW, self.middleView.xmg_height);
    
    
    //fastLoginView
    
    self.fastLoginView.frame=CGRectMake(0, 0, self.bottomView.xmg_width, self.bottomView.xmg_height);
    
    
}


@end
